package com.androidx.p013lv.base.utils;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Process;
import androidx.core.content.FileProvider;
import com.lzy.okgo.OkGo;
import com.lzy.okserver.OkDownload;
import com.lzy.okserver.download.DownloadListener;

import java.io.File;
/*import p000a.lzy.p004a.OkDownload;
import p000a.lzy.p004a.download.DownloadListener;*/

/* renamed from: com.androidx.lv.base.utils.DownloadFileUtils */
public class DownloadFileUtils {
    public static void startDownloadFile(String str, String str2, String str3, String str4, DownloadListener downloadListener) {
        OkDownload.request(str2, OkGo.get(str)).folder(str3).fileName(str4).save().register(downloadListener).start();
    }

    public static void openFile(Context context, File file) {
        Uri uri;
        Intent intent = new Intent("android.intent.action.VIEW");
        try {
            if (Build.VERSION.SDK_INT >= 24) {
                uri = FileProvider.getUriForFile(context, context.getPackageName() + ".fileprovider", file);
                intent.setAction("android.intent.action.INSTALL_PACKAGE");
                intent.addFlags(1);
            } else {
                uri = Uri.fromFile(file);
                intent.setAction("android.intent.action.VIEW");
                intent.setFlags(268435456);
            }
            intent.setDataAndType(uri, "application/vnd.android.package-archive");
            context.startActivity(intent);
            Process.killProcess(Process.myPid());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
